package stcpscheculer;

import java.util.Set;

public class Driver {
	
	public int DriverId;
	public Set<String> BusTypes; // experience in Bus Types
	public Set<String> BusTypesPref; // preference in Bus Types
	public int MaxWorkTime;
	int HoursWorking; // total hours working
	Pair<Integer, Integer> timePreference; // schedule preferences <from, to>, values: 0-24
	int[] schedule;
	int Slots;

	public Driver(int id, Set<String> types, Set<String> typesPref, int maxTime, Pair<Integer, Integer> pref){

		DriverId = id;
		BusTypes = types; 
                BusTypesPref = typesPref;
		MaxWorkTime = maxTime;
		timePreference = pref;

                Slots = Configuration.getSlots();
                schedule = new int[Slots];
		
	}
        
        /**
         * Checks if timeslot is within driver's time preferences
         * 
         * @param int timeslot - number of the timeslot, values within [0,Slots-1]
         * @return true if timeslot is ok, false if timeslot is not ok
         */
        boolean timeslotIsOk(int timeslot){ 
            int fromHour;
            int toHour;
            fromHour = timeslot*Configuration.getTimeSlot();
            toHour = fromHour + Configuration.getTimeSlot();
            if(fromHour >= timePreference.getElement0() 
                    && toHour <= timePreference.getElement1())
                return true;
            return false;
        }
}
